package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.antlr.v4.runtime.misc.NotNull;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.ExpressionContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.SelectAliasContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.StreamAllColumnsContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.SelectExpressionContext;

/**
 * select 表达式语法结构遍历
 * 
 * @author zwd
 *
 */
public class SelectExpressionVisitor extends AbsCQLParserBaseVisitor<SelectExpressionContext> {

	private SelectExpressionContext context = null;

	public SelectExpressionVisitor() {
		context = new SelectExpressionContext();
	}

	@Override
	protected SelectExpressionContext defaultResult() {
		return context;
	}

	@Override
	public SelectExpressionContext visitExpression(@NotNull ExpressionContext ctx) {
		ExpressionVisitor visitor = new ExpressionVisitor();
		context.setExpression(visitor.visit(ctx));
		return context;
	}

	@Override
	public SelectExpressionContext visitSelectAlias(@NotNull SelectAliasContext ctx) {
		SelectAliasVisitor visitor = new SelectAliasVisitor();
		context.setAlias(visitor.visit(ctx));
		return context;
	}

	@Override
	public SelectExpressionContext visitStreamAllColumns(@NotNull StreamAllColumnsContext ctx) {
		StreamAllColumnsVisitor visitor = new StreamAllColumnsVisitor();
		context.setAllColumns(visitor.visit(ctx));
		return context;
	}

}
